/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Anonymous
 * License Type: Purchased
 */
package com.estate.datalogic;

import org.orm.*;
import java.io.Serializable;
import javax.persistence.*;
/**
 * ORM-Persistable Class
 */
@Entity
@Table(name="advertisements")
@org.hibernate.annotations.Proxy(lazy=false)
public class Advertisement implements Serializable {
	public Advertisement() {
	}
	
	private void this_setOwner(Object owner, int key) {
		if (key == com.estate.datalogic.ORMConstants.KEY_ADVERTISEMENT_CLIENT) {
			this.client = (com.estate.datalogic.Client) owner;
		}
		
		else if (key == com.estate.datalogic.ORMConstants.KEY_ADVERTISEMENT_AD_TYPEIDAD_TYPE) {
			this.ad_typeidAd_type = (com.estate.datalogic.Ad_type) owner;
		}
		
		else if (key == com.estate.datalogic.ORMConstants.KEY_ADVERTISEMENT_TOWN) {
			this.town = (com.estate.datalogic.Town) owner;
		}
	}
	
	@Transient	
	org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
		public void setOwner(Object owner, int key) {
			this_setOwner(owner, key);
		}
		
	};
	
	@Column(name="idAssignment", nullable=false)	
	@Id	
	@GeneratedValue(generator="V9F6BA607137FFC8BFF108CD0")	
	@org.hibernate.annotations.GenericGenerator(name="V9F6BA607137FFC8BFF108CD0", strategy="increment")	
	private int idAssignment;
	
	@Column(name="overview", nullable=true)	
	private String overview;
	
	@Column(name="ava_to_move_in", nullable=true, length=45)	
	private String ava_to_move_in;
	
	@Column(name="ava_period", nullable=true, length=45)	
	private String ava_period;
	
	@Column(name="address1", nullable=true, length=45)	
	private String address1;
	
	@Column(name="address2", nullable=true)	
	private String address2;
	
	@ManyToOne(cascade={ CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH })	
	@JoinColumns({ @JoinColumn(name="clientid", referencedColumnName="id") })	
	@Basic(fetch=FetchType.LAZY)	
	private com.estate.datalogic.Client client;
	
	@ManyToOne(cascade={ CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH })	
	@JoinColumns({ @JoinColumn(name="ad_typeidAd_type", referencedColumnName="idAd_type") })	
	@Basic(fetch=FetchType.LAZY)	
	private com.estate.datalogic.Ad_type ad_typeidAd_type;
	
	@OneToOne(cascade={ CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH })	
	@JoinColumns({ @JoinColumn(name="tc_townsid") })	
	@Basic(fetch=FetchType.LAZY)	
	private com.estate.datalogic.Town town;
	
	private void setIdAssignment(int value) {
		this.idAssignment = value;
	}
	
	public int getIdAssignment() {
		return idAssignment;
	}
	
	public int getORMID() {
		return getIdAssignment();
	}
	
	public void setOverview(String value) {
		this.overview = value;
	}
	
	public String getOverview() {
		return overview;
	}
	
	public void setAva_to_move_in(String value) {
		this.ava_to_move_in = value;
	}
	
	public String getAva_to_move_in() {
		return ava_to_move_in;
	}
	
	public void setAva_period(String value) {
		this.ava_period = value;
	}
	
	public String getAva_period() {
		return ava_period;
	}
	
	public void setAddress1(String value) {
		this.address1 = value;
	}
	
	public String getAddress1() {
		return address1;
	}
	
	public void setAddress2(String value) {
		this.address2 = value;
	}
	
	public String getAddress2() {
		return address2;
	}
	
	public void setClient(com.estate.datalogic.Client value) {
		if (client != null) {
			client.advertisement.remove(this);
		}
		if (value != null) {
			value.advertisement.add(this);
		}
	}
	
	public com.estate.datalogic.Client getClient() {
		return client;
	}
	
	/**
	 * This method is for internal use only.
	 */
	public void setORM_Client(com.estate.datalogic.Client value) {
		this.client = value;
	}
	
	private com.estate.datalogic.Client getORM_Client() {
		return client;
	}
	
	public void setAd_typeidAd_type(com.estate.datalogic.Ad_type value) {
		if (ad_typeidAd_type != null) {
			ad_typeidAd_type.advertisement.remove(this);
		}
		if (value != null) {
			value.advertisement.add(this);
		}
	}
	
	public com.estate.datalogic.Ad_type getAd_typeidAd_type() {
		return ad_typeidAd_type;
	}
	
	/**
	 * This method is for internal use only.
	 */
	public void setORM_Ad_typeidAd_type(com.estate.datalogic.Ad_type value) {
		this.ad_typeidAd_type = value;
	}
	
	private com.estate.datalogic.Ad_type getORM_Ad_typeidAd_type() {
		return ad_typeidAd_type;
	}
	
	public void setTown(com.estate.datalogic.Town value) {
		if (this.town != value) {
			com.estate.datalogic.Town ltown = this.town;
			this.town = value;
			if (value != null) {
				town.setAdvertisement(this);
			}
			else {
				ltown.setAdvertisement(null);
			}
		}
	}
	
	public com.estate.datalogic.Town getTown() {
		return town;
	}
	
	public String toString() {
		return String.valueOf(getIdAssignment());
	}
	
}
